<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改账户间往来')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-transfer-edit" th:object="${bankAccountTransfer}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">流入账户：</label>
                <div class="col-sm-8">
                    <select name="inAccount" class="form-control" th:with="type=${@customDictService.selectDictBanks()}">
                        <option value="0">无</option>
                        <option th:each="dict : ${type}" th:text="${dict.name}" th:value="${dict.id}" th:field="*{inAccount}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">流出账户：</label>
                <div class="col-sm-8">
                    <select name="outAccount" class="form-control" th:with="type=${@customDictService.selectDictBanks()}">
                        <option value="0">无</option>
                        <option th:each="dict : ${type}" th:text="${dict.name}" th:value="${dict.id}" th:field="*{outAccount}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">金额：</label>
                <div class="col-sm-8">
                    <input name="amount" th:field="*{amount}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="payDate" th:value="${#dates.format(bankAccountTransfer.payDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <textarea name="remark" class="form-control" rows="8">[[*{remark}]]</textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "erp/transfer";
        $("#form-transfer-edit").validate({
            focusCleanup: true,
            rules: {
                amount: {
                    number: true
                }
            }
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-transfer-edit').serialize());
            }
        }

        $("input[name='payDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>